<template>
  <div class="mine">
    <van-skeleton title :avatar="true" :row="3" :loading="loading">
      <div class="user-info">
        <div class="info">
          <img src="https://s.yezgea02.com/1604040746310/aaaddd.png"/>
          <div class="user-desc">
            <span>昵称：{{userInfo.nickName}}</span>
            <span>登录名：{{userInfo.loginName}}</span>
            <span class="name">个性签名：{{userInfo.introduceSign}}</span>
          </div>
        </div>
      </div>
    </van-skeleton>
    <ul class="user-list">
      <li 
        v-for="item in mineFnlist"
        :key="item.path" 
        class="van-hairline--bottom" 
        @click="navigateTo(item)"
      >
        <span>{{item.title}}</span>
        <van-icon name="arrow" />
      </li>
    </ul>
  </div>
</template>

<script setup>
import {ref} from 'vue'
import {useRouter} from 'vue-router'
import useUserInfo from '@/hooks/useUserInfo'
import {mineFnlist} from '@/plugins/mock'

const loading = ref(false)
const router = useRouter()
const {userInfo} = useUserInfo()

function navigateTo(item) {
  router.push({path: item.path, query: item.params ? item.params : {}})
}
</script>

<style lang="less" scoped>
@import '@/assets/style/var.less';
@import '@/assets/style/mixin.less';

.mine {
  .user-header {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 10000;
    .fj();
    .wh(100%, 44px);
    line-height: 44px;
    padding: 0 10px;
    .boxSizing();
    color: #252525;
    background: #fff;
    border-bottom: 1px solid #dcdcdc;
    .user-name {
      font-size: @font-size-p;
    }
  }
  .user-info {
    width: 94%;
    margin: 10px;
    height: 115px;
    background: linear-gradient(90deg, @primary, #51c7c7);
    box-shadow: 0 2px 5px #269090;
    border-radius: 6px;
    .info {
      position: relative;
      display: flex;
      width: 100%;
      height: 100%;
      padding: 25px 20px;
      .boxSizing();
      img {
        .wh(60px, 60px);
        border-radius: 50%;
        margin-top: 4px;
      }
      .user-desc {
        display: flex;
        flex-direction: column;
        margin-left: 10px;
        line-height: 20px;
        font-size: @font-size-p;
        color: #fff;
        span {
          color: #fff;
          font-size: @font-size-p;
          padding: 2px 0;
        }
      }
      .account-setting {
        position: absolute;
        top: 10px;
        right: 20px;
        font-size: 13px;
        color: #fff;
        .van-icon-setting-o {
          font-size: 16px;
          vertical-align: -3px;
          margin-right: 4px;
        }
      }
    }
  }
  .user-list {
    padding: 0 20px;
    margin-top: 20px;
    li {
      height: 45px;
      line-height: 45px;
      display: flex;
      justify-content: space-between;
      font-size: @font-size-p;
      .van-icon-arrow {
        margin-top: 13px;
      }
    }
  }
}
</style>
